Hello guys,
string objNo = "3.8.2.1.0"
int noOfChars = length objNo
// Validate only the last character to ensure that it is a number.
if( ((intOf objNo[noOfChars-1]) < 48 ) || ((intOf objNo[noOfChars-1]) > 57 ) )
{
ack "Invalid section number: Shall end only with a number !"
halt
}
Object othero = null
string s = null
filtering off
for othero in current Module do
{
s = probeAttr_(othero,"Object Number")
if( (s[0:(noOfChars-1)] == objNo) && ( (s[noOfChars:noOfChars] == "") || (s[noOfChars:noOfChars] == ".") || (s[noOfChars:noOfChars] == "-") ) )
accept othero
else
reject othero
}
filtering on
bullbala - Wed Feb 16 04:51:39 EST 2011 |
Re: Filter module based on Section Number (Object Number) Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Filter module based on Section Number (Object Number) Mathias Mamsch - Wed Feb 16 11:45:17 EST 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Filter module based on Section Number (Object Number)
Thank you for your response, Mathias. (s[noOfChars:noOfChars] == "")
(null (s[noOfChars:noOfChars]))
string objNo = "3.1"
int noOfChars = length objNo
// Validate the section number.
for(index = 0; index < noOfChars; index++)
{
// If it is the last character ...
if( index == (noOfChars - 1) )
{
// Validate the last character to ensure that it is only a digit.
if(!isdigit objNo[index])
{
ack "Invalid section number: Shall end only with a number !"
halt
}
}
else
{
if( (!isdigit objNo[index]) && (objNo[index] != '.') && (objNo[index] != '-') )
{
ack "Invalid section number: Shall contains only digits, '.' and '-' !"
halt
}
}
}
Object othero = null
string s = null
filtering off
for othero in current Module do
{
s = probeAttr_(othero,"Object Number")
if( (s[0:(noOfChars-1)] == objNo) && ( (s[noOfChars:noOfChars] == "") || (s[noOfChars:noOfChars] == ".") || (s[noOfChars:noOfChars] == "-") ) )
accept othero
else
reject othero
}
filtering on
|
Re: Filter module based on Section Number (Object Number) perhaps i don't understand well the problem, but why don't use filer : >= 3.1 AND < 3.10 Pierre |
Re: Filter module based on Section Number (Object Number)
Thank you for your suggestion, Pierre.
...
if( (s[0:(noOfChars-1)] == objNo) && (!isdigit s[noOfChars]) )
accept othero
else
reject othero
...
...
if (matches("^3\\.1(($)|([^0-9]))", s))
accept othero
else
reject othero
...
|
Re: Filter module based on Section Number (Object Number) bullbala - Thu Feb 17 02:46:19 EST 2011
Thank you for your suggestion, Pierre.
...
if( (s[0:(noOfChars-1)] == objNo) && (!isdigit s[noOfChars]) )
accept othero
else
reject othero
...
...
if (matches("^3\\.1(($)|([^0-9]))", s))
accept othero
else
reject othero
...
Yeah, you are right, you would need to escape the '.' in the input string since "3.1" would also match 301. string x = "abc" print isdigit x[3] // this works print isdigit x[4] // -R-E- DXL: <Line:3> index beyond end of string [4]
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Filter module based on Section Number (Object Number)
Thank you Mathias & Pierre. ... int noOfChars = length objNo ... ... ... if( (s[0:(noOfChars-1)] == objNo) && (!isdigit s[noOfChars]) ) ...
|
Re: Filter module based on Section Number (Object Number) bullbala - Thu Feb 17 04:36:26 EST 2011
Thank you Mathias & Pierre. ... int noOfChars = length objNo ... ... ... if( (s[0:(noOfChars-1)] == objNo) && (!isdigit s[noOfChars]) ) ...
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |